package com.annual.web.controller.app;

import com.annual.common.core.controller.BaseController;
import com.annual.common.core.domain.AjaxResult;
import com.annual.common.core.page.TableDataInfo;
import com.annual.system.domain.SysConfig;
import com.annual.system.domain.SysLogininfor;
import com.annual.system.dto.enterpriseBusiness.*;
import com.annual.system.dto.order.ReqOrderIdDto;
import com.annual.system.service.IEnterpriseBusinessService;
import com.annual.system.service.IOrderService;
import com.annual.system.service.ISysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 参数配置 信息操作处理
 * 
 * @author annualReview
 */
@Api(tags="年审送报")
@RestController
@RequestMapping("/app/enterprise")
public class AppEnterpriseBusinessController extends BaseController{

    @Autowired
    private IEnterpriseBusinessService enterpriseBusinessService;
    @Autowired
    private IOrderService orderService;

    @ApiOperation(value = "我的-列表",notes = "ywb")
    @GetMapping("/list")
    public TableDataInfo appList(ReqAppEnterpriseBusinessListDto req){
        startPage();
        List<ResAppEnterpriseBusinessListDto> list = enterpriseBusinessService.appList(req);
        return getDataTable(list);
    }

    @ApiOperation(value = "添加",notes = "ywb",response = ResAppEnterpriseBusinessDto.class)
    @PostMapping("/addBusiness")
    public AjaxResult<ResAppEnterpriseBusinessDto> addBusiness(@RequestBody @Validated ReqAppEnterpriseBusinessDto req){
        ResAppEnterpriseBusinessDto res = enterpriseBusinessService.addBusiness(req);
        return success(res);
    }

    @ApiOperation(value = "下单",notes = "ywb")
    @PostMapping("/placeOrder")
    public AjaxResult<Map<String, Object>> placeOrder(@RequestBody @Validated ReqOrderIdDto req){
        Map<String,Object> data = orderService.placeOrder(req.getOrderId());
        return success().put("data",data);
    }


}
